import index from "@/pages/frontend/index.vue";
import login from '@/pages/admin/login.vue'
import { createRouter, createWebHashHistory, createWebHistory } from "vue-router";

//声明路由
const routes = [
    {
        path: '/',
        component: index,
        meta: {
            title: '首页'
        }
    },
    {   // 后台登录页
        path: '/login',
        component: login,
        meta: {
            title: '登录页'
        }
    },
    {   // 后台首页
        path: '/admin',
        component: ()=> import('@/composition/admin/admin.vue'),
        children: [
            { path: '/admin/index', component: ()=> import('@/pages/admin/index.vue') , meta: { title: '仪表盘'}},
            { path: '/admin/article/list', component: ()=> import('@/pages/admin/article-list.vue') , meta: { title: 'Admin后台文章管理'}},
            { path: '/admin/category/list', component: ()=> import('@/pages/admin/category-list.vue') , meta: { title: 'Admin后台分类管理'}},
            { path: '/admin/tag/list', component: ()=> import('@/pages/admin/tag-list.vue') , meta: { title: 'Admin后台标签管理'}},
            { path: '/admin/blog/setting', component: ()=> import('@/pages/admin/blog-setting.vue') , meta: { title: 'Blog设置'}}, 
            { path: '/admin/wiki/list', component: ()=> import('@/pages/admin/wiki-list.vue') , meta: { title: 'Wiki' },}
        ],
        redirect: '/admin/index'
    },
    {   //前台归档页
        path: '/archive/list',
        component: ()=> import('@/pages/frontend/archiveList.vue'),
        meta: {
            title: '归档页'
        }
    },
    {   //前台分类页
        path: '/category/list',
        component: ()=> import('@/pages/frontend/categoryList.vue'),
        meta: {
            title: '分类页'
        }
    },
    {   //前台分类文章列表页
        path: '/category/article/list',
        component: ()=> import('@/pages/frontend/categoryArticleList.vue'),
        meta: {
            title: '分类文章页'
        }
    },
    {   //前台标签页
        path: '/tag/list',
        component: ()=> import('@/pages/frontend/tagList.vue'),
        meta: {
            title: '标签页'
        }
    },
    {   //前台标签文章列表页
        path: '/tag/article/list',
        component: ()=> import('@/pages/frontend/tagArticleList.vue'),
        meta: {
            title: '标签文章页'
        }
    },
    {   //前台文章详情页
        path: '/article/:articleId',
        component: ()=> import('@/pages/frontend/articleDetail.vue'),
        meta: {
            title: '文章详情页'
        }
    },
    {   //前台Wiki列表页
        path: '/wiki/list',
        component: ()=> import('@/pages/frontend/wikiList.vue'),
        meta: {
            title: 'Wiki列表页'
        }
    },
    {   //前台Wiki详情页
        path: '/wiki/:wikiId',
        component: ()=> import('@/pages/frontend/wikiDetail.vue'),
        meta: {
            title: 'Wiki详情页'
        }
    },
    {   // 404
        path: '/:pathMatch(.*)*',
        name: 'NotFound',
        component: ()=> import('@/pages/frontend/notFound.vue'),
        meta: {
            title: '404'
        }
    },
]

//创建路由
const router = createRouter({
    // 指定路由的历史管理方式，hash 模式指的是 URL 的路径是通过 hash 符号（#）进行
    history: createWebHashHistory(),
    routes
})




//导出
export default router